/* $RCSFile: ModuleItem.cs $
 * Apache license v2 2011 by Christian Surieux
 * $Source: ?/ADNCRM.Core/Configuration/Items/ModuleItem.cs $
 * $log$
 * Revision 6 2010/08/06 19:56:27  christian.surieux
 *   Added Log to All cs files
 */

using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Data.SqlClient;
using AddonNice.Security;
using System.IO;

namespace AddonNice.Configuration
{
    /// <summary>
    /// This class encapsulates the basic attributes of a Module, and is used
    /// by the administration pages when manipulating modules.<br/>
    /// ModuleItem implements the IComparable interface so that an ArrayList
    /// of ModuleItems may be sorted by ModuleOrder, using the 
    /// ArrayList's Sort() method.
    /// </summary>
    public class ModuleItem : IComparable 
    {
        private int      _moduleOrder;
        private String   _title;
        private String   _pane;
        private int      _ID;
        private int      _defID;

        /// <summary>
        /// Order
        /// </summary>
        public int Order 
        {
            get 
            {
                return _moduleOrder;
            }
            set 
            {
                _moduleOrder = value;
            }
        }    

        /// <summary>
        /// Title
        /// </summary>
        public String Title 
        {
            get 
            {
                return _title;
            }
            set 
            {
                _title = value;
            }
        }

        /// <summary>
        /// Pane name
        /// </summary>
        public String PaneName 
        {
            get 
            {
                return _pane;
            }
            set 
            {
                _pane = value;
            }
        }
        
        /// <summary>
        /// ID
        /// </summary>
        public int ID 
        {
            get 
            {
                return _ID;
            }
            set 
            {
                _ID = value;
            }
        }  
  
        /// <summary>
        /// Definition id
        /// </summary>
        public int ModuleDefID 
        {
            get 
            {
                return _defID;
            }
            set 
            {
                _defID = value;
            }
        } 
   
        public Guid ModuleGuid  =   Guid.Empty; 
 
        
        /// <summary>
        /// Public comparer
        /// </summary>
        /// <param name="value"></param>
        /// <returns></returns>
        public int CompareTo(object value) 
        {
            if (value == null) 
                return 1;

            int compareOrder = ((ModuleItem)value).Order;
            
            if ( Order == compareOrder ) 
                return 0;
            if ( Order < compareOrder ) 
                return -1;
            return 1;
        }
    }
}